<!DOCTYPE html>
<html lang="zh">

	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<meta http-equiv="X-UA-Compatible" content="ie=edge" />
		<link rel="stylesheet" type="text/css" href="../img-font/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="../css/css.css" />
		<script src="../js/jquery.min.js"></script>
		<script src="../js/main.js"></script>
		<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
		<script src="../js/Url.js"></script>
		<title></title>
	</head>
	<style type="text/css">
		.record-external {
			width: 100%;
			height: 100%;
			background: #ebebeb;
		}
		
		.record {
			width: 100%;
			height: 40px;
			text-align: center;
			background: #666;
			line-height: 40px;
			color: #fff;
		}
		
		.topnav {
			width: 100%;
			height: 30px;
			background: #fff;
			position: fixed;
			top: 0;
			left: 0;
			z-index: 666;
			padding-top: 10px;
			padding-bottom: 10px;
			padding-right: 30px;
			text-align: center;
		}
		
		.fanjian {
			height: 100%;
			display: block;
			color: #000;
			font-size: 24px;
			line-height: 30px;
			float: left;
			text-indent: 24px;
			position: absolute;
			top: 10px;
			left: 0;
		}
		
		.span-left {
			float: left;
		}
		
		nav {
			width: 100%;
			margin-top: 50px;
			/*			background: #fff;
*/
		}
		
		nav ul {
			display: block;
			width: 100%;
			height: 100%;
			display: flex;
			margin-top: 20px;
		}
		
		nav ul li {
			display: block;
			width: 25%;
			text-align: center;
			line-height: 24px;
			font-size: 12px;
			white-space: nowrap;
			overflow: hidden;
		}
		
		nav ul li div {
			height: 100%;
			width: 100%;
			margin: 0 auto;
			overflow: hidden;
			text-overflow: ellipsis;
		}
		
		.list {
			width: 110px;
			color: red;
		}
		
		.past {
			width: 110px;
		}
		.bun-right{float: right;}
		
		.cover {
			width: 100%;
			height: 100%;
			position: fixed;
			top: 0;
			left: 0;
			background: rgba(0, 0, 0, 0.4);
			z-index: 666;
			display: none;
			text-align: center;
		}
		
		.modify {
			width: 250px;
			height: 250px;
			background: #fff;
			margin: auto;
			position: absolute;
			top: 0;
			left: 0;
			right: 0;
			bottom: 0;
		}
		
		.modify p {
			font-size: 10px;
			color: #666;
			line-height: 24px;
		}
		
		.toppa {
			width: 100%;
			background: turquoise;
			text-align: center;
			line-height: 24px;
			font-size: 14px;
			color: #666;
		}
		
		.inout {
			margin: 15px 0px;
			width: 100%;
		}
		
		.input-warry {
			width: 150px;
			height: 150px;
			position: absolute;
			top: 0;
			left: 0;
			right: 0;
			bottom: 0;
			margin: auto;
		}
		
		.inhtml {
			width: 100%;
			text-align: center;
			line-height: 24px;
			color: red;
			margin-top: 80px;
			font-size: 12px;
		}
		
		.cover span {
			display: block;
			width: 70px;
			height: 30px;
			line-height: 30px;
			text-align: center;
			position: absolute;
			top: 15px;
			right: 15px;
			font-size: 16px;
			color: #fff;
			font-weight: bold;
		}
	</style>

	<body>
		<!--纪录列表-->
		<div class="record-external">
			<div class="topnav">
				<a href="javascript:history.go(-1)"><span class="fanjian iconfont icon-xia"></span></a>发布广告纪录
			</div>
			<nav>
				<ul>
					<li>标题</li>
					<li>发布时间</li>
					<li>发布金额</li>
					<li>类型</li>
					<li>操作</li>
				</ul>
			</nav>
		</div>

		<div class="cover">
			<div class="modify">
				<div class="toppa">
					修改广告金
				</div>
				<p>输入金额不能大于现有余额且不能小于点击金额</p>

				<div class="input-warry">
					<input type="number" placeholder="请输入金额" class="inout" /><br />
					<input type="button" value="确定" class="button-s" />
				</div>
				<div class="inhtml"></div>
			</div>
			<span>关闭</span>
		</div>
	</body>

</html>
<script type="text/javascript">
	//时间转换
	function getLocalTime(nS) {
		return new Date(parseInt(nS)).toLocaleString().substr(0, 17)

	}

	$(function() {
		$.ajax({
			type: "get",
			url:baseUrl+ "foot/advert/getAdvertAll",
			contentType: "application/json; charset=utf-8",
			success: function(res) {
				console.log(res)
				var app = res.data.value;
				for(var i = 0; i < app.length; i++) {
					var acc = '';
					acc += getLocalTime(res.data.value[i].createTime);
					var str = '';
					str += '<ul>';
					str += '<li><div>' + res.data.value[i].advertContent + '</div></li>';
					str += '<li>' + acc.substring(9, length) + '</li>';
					str += '<li>' + res.data.value[i].advertTopMoney + '</li>';
					if(res.data.value[i].gitMoney == 0) {
						str += '<li>个人</li>';
					} else if(res.data.value[i].gitMoney == 1) {
						str += '<li>赠送</li>';
					}
					if(res.data.value[i].status == 0) {
						str += '<li class="past"><span class="span-left">正常</span><button title="' + res.data.value[i].id + '" class="bun-right">修改</button></li>';
					} else {
						str += '<li class="list"><span>余额不足</span><button title="' + res.data.value[i].id + '" class="bun-right">修改</button></li>';
					}

					str += '</ul>';

					$('nav').append(str);
				};
				var title = '';
				$('.bun-right').on('click', function() {
					$('.cover').show();
					title = $(this).attr('title');
				});
				$('.cover >span').on('click', function() {
					$('.cover').hide();
				})
				$('.button-s').on('click', function() {

					$.ajax({
						type: "get",
						url: baseUrl + "foot/advert/updateAdvertTopMoney",
						contentType: "application/json; charset=utf-8",
						data: {
							'id': title,
							'money': $('.inout').val()
						},
						success: function(res) {
							if(res.error_code == 1) {
								$('.inhtml').html('您输入的金额超过您的余额或者追加金额不足！')
							} else if(res.error_code == 0) {
								$('.inhtml').html('');
								window.location.reload()
							}
						}
					});
				})
			}
		});

	});
	//				$(function(){
	//					$('button').on('click', function() {
	//					console.log(111)
	//					$('.cover').css('display', 'block')
	//				})
	//				})
</script>
<script>
		var Url = baseUrl+"subpage/ggao-record.html";
		$.ajax({
			url: '/wechat/getweixinjs',
			data: {
				url: Url
			},
			type: 'get',
			dataType: 'json',
			success: function(res) {
				console.log(res)
				wx.config({
					debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
					appId: res.data.appId, // 必填，公众号的唯一标识
					timestamp: res.data.timestamp, // 必填，生成签名的时间戳
					nonceStr: res.data.nonceStr, // 必填，生成签名的随机串
					signature: res.data.signature, // 必填，签名，见附录1
					jsApiList: ["hideMenuItems"] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
				});
			}
		})
	
		wx.ready(function() {
			hideMenu();
		});
		wx.error(function(res) {
	
		});
	
		function hideMenu() {
			wx.hideMenuItems({
				menuList: ["menuItem:share:email","menuItem:copyUrl","menuItem:share:appMessage","menuItem:share:timeline","menuItem:favorite","menuItem:openWithQQBrowser","menuItem:openWithSafari","menuItem:share:qq","menuItem:share:QZone"]
			});
		}
</script>